#ifndef RichEditOleCallbackH
#define RichEditOleCallbackH

#include <vcl\comctrls.hpp>
#include <vcl\comobj.hpp>
#include <vcl\ole2.hpp>
#include <vcl\oledlg.hpp>
#include <richole.h>

//---------------------------------------------------------------------------
class CRichEdit;

class TIRichEditOleCallback : public IRichEditOleCallback
{
protected:
   CRichEdit* FRichEdit;
   ULONG FRefCnt;
   bool FAcceptDrop;

public:
   // *** IUnknown methods ***
   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lplpObj);
   STDMETHOD_(ULONG, AddRef) (THIS);
   STDMETHOD_(ULONG, Release) (THIS);

   // *** IRichEditOleCallback methods ***
   STDMETHOD(GetNewStorage) (THIS_ LPSTORAGE FAR * lplpstg);
   STDMETHOD(GetInPlaceContext) (THIS_ LPOLEINPLACEFRAME FAR * lplpFrame,
      LPOLEINPLACEUIWINDOW FAR * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo);
   STDMETHOD(ShowContainerUI) (THIS_ BOOL fShow);
   STDMETHOD(QueryInsertObject) (THIS_ LPCLSID lpclsid, LPSTORAGE lpstg,
      LONG cp);
   STDMETHOD(DeleteObject) (THIS_ LPOLEOBJECT lpoleobj);
   STDMETHOD(QueryAcceptData) (THIS_ LPDATAOBJECT lpdataobj,
      CLIPFORMAT FAR * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
   STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode);
   STDMETHOD(GetClipboardData) (THIS_ CHARRANGE FAR * lpchrg, DWORD reco,
      LPDATAOBJECT FAR * lplpdataobj);
   STDMETHOD(GetDragDropEffect) (THIS_ BOOL fDrag, DWORD grfKeyState,
      LPDWORD pdwEffect);
   STDMETHOD(GetContextMenu) (THIS_ WORD seltype, LPOLEOBJECT lpoleobj,
      CHARRANGE FAR * lpchrg, HMENU FAR * lphmenu);

   TIRichEditOleCallback(CRichEdit* richedit);
   ~TIRichEditOleCallback(void);

   __property bool AcceptDrop = { read = FAcceptDrop, write = FAcceptDrop };
};

#endif

